<?php
include_once './model/testimoni.php';
class TestimoniController {
	public function invoke () {
		$testimoni = new ModelTestimoni();
		if (isset($_POST['id_user']) and isset($_POST['nama_pengirim'])and isset($_POST['isitestimoni'])and isset($_POST['judultestimoni'])) {
			$testi=$testimoni->addTestimoni($_POST['id_user'],$_POST['nama_pengirim'],$_POST['isitestimoni'],$_POST['judultestimoni']);
			if ($testi) {
				$id = $_POST['id_user'];
				header("location:./view/list_testimoni.php?id_user=$id");
			} else {
				header('location:./view/insert_testimoni.php');
			}
		} elseif (isset ($_GET['testimoni'])) {
			$id = $_GET['testimoni'];
			header("location:./view/list_testimoni.php?id_user=$id");
		}
	}
}